<?php

/**
 * 可用项目初始化
 */
class InitBehavior extends Behavior {

    //行为参数定义
    protected $options = array();

    public function run(&$params) {
        /**
         * 初始化网站基本配置
         */
        if (!file_exists(RUNTIME_PATH . "define.php")) {
            D("Config")->config_cache();
        }
        include RUNTIME_PATH . "define.php";
        //网站访问地址
        define("SITEURL", CONFIG_SITEURL);

        /* @todo 加载所有可用的模块 */
        /*
        $dir = scandir(APP_PATH . "Modules");
        $remove_dir = array(
            ".",
            "..",
            "!Default",
            "index.html"
        );
        foreach ($remove_dir as $value) {
            $key = array_search($value, $dir);
            if ($key !== false) {
                unset($dir[$key]);
            }
        }
        */
        C('DEFAULT_GROUP', "Admin");
        C('APP_GROUP_LIST', "Admin,Api,Attachment,Ding");
    }

}

?>
